<template>
  <view class="approval-item">
    <CommonHeader>出差申请</CommonHeader>
    <view class="approval-content">
      <CommonInfo approvalType="出差" />
      <view class="input-area">
        <Field label="出差地点" @getValue="getAddress" />
        <Field label="出行工具" @getValue="getTravelTools" />
        <DateSelect label="出差开始时间" @getSelectDate="getStartTime" />
        <DateSelect label="出差结束时间" @getSelectDate="getEndTime" />
        <Textarea label="出差事由" @getInputData="getTravelReason" />
      </view>
      <ApprovalButton
        :warn="warn"
        :approvalType="'travel'"
        :procInfo="{
          address: approval.address,
          travelTools: approval.travelTools,
          days: String(
            Math.floor(
              ((approval.endTime - approval.startTime) /
                3600000 /
                24) *
                100
            ) / 100
          ),
          startTime: String(approval.startTime),
          endTime: String(approval.endTime),
          travelReason: approval.travelReason,
        }"
      />
    </view>
    <van-toast id="van-toast" />
  </view>
</template>
<script src="./script.js"></script>
<style lang="less" src="./style.less"></style>
